package com.hsource.doctorcenter.controller;

import com.hsource.common.utils.CommonResp;
import com.hsource.common.utils.resultUtils.controller.BaseController;
import com.hsource.doctorcenter.domain.dict.DictData;
import com.hsource.doctorcenter.service.dict.IDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author yangYang
 * @version 1.0
 * @date 2020/9/24 17:26
 * @describe 字典数据控制层
 */
@Controller
@RequestMapping("/dicData")
public class DicDataController extends BaseController {
    @Autowired
    private IDictDataService dictDataService;

    /**
     * 获取字典数据
     * @param dicType
     * @return
     */
    @PostMapping("/getDicDatas")
    @ResponseBody
    public CommonResp getDicDatas(String dicType) {
        List<DictData> dictDatas= dictDataService.selectDictDataByType(dicType);
        Map<String,Object> map=new HashMap<>();
        map.put("dicData",dictDatas);
        return success(map);
    }

}
